<template>
    <div>子组件内容</div>
    <div>父组件传来的参数：{{ msg }}</div>
    <button @click="clickAdd">点击增加</button>
    <div v-for="i in arr">{{ i }}</div>
</template>

<script>
    export default {
        name: 'Child',
        props: {
            msg : {
                type: String,
                required: true
            },
            arr : {
                type: Array,
            }
        },
        data() {
            return {
                num: 0
            }
        },
        methods: {
            clickAdd() {
                this.num++;
                console.log(this.num);
                this.$emit('numAdd', this.num);
            }
        },
        emits: ['numAdd']
    }
</script>